import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;


public class Unificatore {
	public static void main(String[] args) {
		File tmpFile;
		Writer outputWriter = null ;
		
		try {
			outputWriter = new FileWriter("output/ITALIANO.TXT");
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		BufferedReader reader;
		char ch = 'A';
		String line = "";
		long startTime = System.currentTimeMillis();
		for (int i = 0; i < 26; i++) {
			tmpFile = new File("files/ITALIANO."+(char) (ch+i));
			
			try {
				reader = new BufferedReader( new FileReader(tmpFile) ) ;
				
				line = reader.readLine();
				
				while(line != null ){
					outputWriter.write(line+"\n");
					line = reader.readLine();
				}
				
				
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		
		System.out.println("tempo impiegato: "+ ( System.currentTimeMillis() - startTime) );
		
	}
}
